package demo2;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

//@Repository
@Service
//@Controller
//@Component
public class User {
    private String username;
    private int age;

    public String getUsername() {
        return username;
    }

    @Value("张三")
    public void setUsername(String username) {
        this.username = username;
    }

    public int getAge() {
        return age;
    }

    @Value("18")
    public void setAge(int age) {
        this.age = age;
    }

    public void sayHello(){
        System.out.println("hello");
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", age=" + age +
                '}';
    }
}
